import request from "@/utils/request";
// import axios from 'axios'
import { apiVersion } from "@/config";
// import { getDeviceId } from '@/utils/tool'

// 获取文件列表
export function getFileList(data) {
	return request({
		url: `/file/${apiVersion}/file/list`,
		method: "post",
		data,
	});
}
// 获取文件列表
export function getPageFileList(data) {
	return request({
		url: `/file/${apiVersion}/file/page`,
		method: "post",
		data,
	});
}
// 获取s3文件列表
export function getS3FileList(data) {
	return request({
		url: `/file/${apiVersion}/external/s3/list`,
		method: "post",
		data,
	});
}
// 删除文件
export function delFile(data) {
	return request({
		url: `/file/${apiVersion}/file/delete`,
		method: "delete",
		data,
	});
}
// 分享
export function getFree(data) {
	return request({
		url: `/file/${apiVersion}/file/modelFree`,
		method: "post",
		data,
	});
}
// 获得下载凭据
export function getDownloadKey(data) {
	return request({
		url: `/file/${apiVersion}/file/getDownloadKey`,
		method: "post",
		data,
	});
}
// 获得下载凭据
export function previewFile(data) {
	return request({
		url: `/file/${apiVersion}/file/preview/${data.userId}/${data.type}/${data.bizId}/${data.encodedRelativePath}`,
		method: "get",
		data,
	});
}
// 更新文件
export function uploadFile(data) {
	return request({
		url: `/file/${apiVersion}/file/upload`,
		method: "post",
		headers: {
			"Content-Type": "multipart/form-data",
		},
		data,
	});
}

// 获取全部文件
export function allFileList(data) {
	return request({
		url: `/file/${apiVersion}/file/list`,
		method: "post",
		data,
	});
}
